<template>
	<view>
		<tn-nav-bar :isBack='true' :backTitle='" "' bottomShadow :alpha="alpha">提现

			<!-- <view slot="right">
				<tn-button fontColor="#FFFFFF" shape='round' width='110rpx' height='53rpx' :fontSize='24'
					backgroundColor="#45C47B">确认</tn-button>
			</view> -->
		</tn-nav-bar>
		<image src="/static/product/topbg.png" class="topbg" mode=""></image>
		<view :style="{paddingTop:'calc('+vuex_custom_bar_height+'px + 50rpx)'}" class="con">
			<view class="con__top">
				<view class="tn-flex tn-flex-col-center tn-flex-row-between">
					<view class="con__top__left">
						最高提现<text style="font-family: DINNextLTPro-Bold;">{{money}}</text>元
					</view>
					<view class="con__top__right" :class='ishover?"tn-hover":""' @touchstart="ishover=true"
						@touchend="ishover=false" @click="value=money">
						全部提现
					</view>
				</view>
				<view class="tn-flex tn-flex-col-bottom" style="padding: 60rpx 0 40rpx;">
					<view class="con__top__unit">
						￥
					</view>
					<tn-input v-model="value"
						:customStyle="{lineHeight:'51rpx',fontSize:'71rpx',color:'#000000',fontFamily:'DINNextLTPro-Bold',fontWeight:'bold'}"
						placeholderStyle='line-height:51rpx;font-size:71rpx;color:#AAAAAA;fontfamily:DINNextLTPro-Bold;' />
				</view>
			</view>
			<view class="line">

			</view>
			<view class="con__way">
				<view class="con__way__title">
					提现方式
				</view>
				<view class="tn-flex tn-flex-col-center tn-flex-row-between">
					<view class="tn-flex tn-flex-col-center">
						<image src="/static/my/wx.png" class="con__way__icon" mode=""></image>
						<view class="con__way__name">
							微信
						</view>
					</view>
					<view class="checkbox">
						<image src="/static/product/gou.png" class="checkbox__icon" mode=""></image>
					</view>
				</view>
				<view class="con__way__tip">
					提现金额会提交后台进行审核.请耐心等待.如果超过48小时还未成功提现，请联系平台客服进行处理
				</view>
				<view class="tn-flex tn-flex-row-center" style="padding: 10rpx 0;">
					<tn-button form-type="submit" fontColor="#FFFFFF" shape='round' width='604rpx' height='99rpx'
						:fontSize='36' backgroundColor="tn-bg-lv" shadow @click="submit">确认</tn-button>
				</view>
			</view>
			<view class="con__mx">
				<view class="con__mx__top">
					<image src="/static/my/txng.png" class="con__mx__topbg" mode=""></image>
					<view class="con__mx__top__text">
						提现<text style="color: #FB7A58;">明细</text>
					</view>
				</view>
				<scroll-view scroll-y="true" class="con__mx__box">
					<view class="con__mx__list">
						<view class="con__mx__list__item" v-for="(item,index) in list" :key="index">
							<view class="tn-flex tn-flex-col-center">
								<image src="/static/my/txitem.png" class="con__mx__list__item__icon" mode=""></image>
								<view class="con__mx__list__item__center">
									<view class="con__mx__list__item__text">
										提现到<text>微信</text>
									</view>
									<view class="con__mx__list__item__time">
										{{timeFormat(item.createtime,'yyyy.mm.dd hh:MM')}}
									</view>
								</view>
							</view>
							<view class="con__mx__list__item__price">
								<text style="font-family:PingFang-SC-Bold;">-</text> {{item.price}}
							</view>
						</view>
					</view>
				</scroll-view>
			</view>
		</view>
	</view>
</template>

<script>
	import user from '@/api/_user.js'
	export default {
		data() {
			return {
				alpha: true,
				ishover: false,
				value: 0,
				list:[],
				money:0
			};
		},
		onLoad() {
			this.getlist()
			this.money=this.$store.state.vuex_userinfo.money
		},
		methods:{
			submit(){
				user.submitTran({method:1,price:this.value}).then(res=>{
					if(res.data.code==1){
						uni.showToast({
							title:'提现申请成功',
							icon:'none'
						})
						this.getlist()
						this.money-=this.value
					}
				})
			},
			getlist(){
				user.myTx().then(res=>{
					if(res.data.code==1){
						this.list=res.data.data
					}
				})
			}
		}
	}
</script>

<style lang="scss">
	page {
		// background-color: #F4F4F4;
	}

	.con {
		padding: 30rpx 0;
		position: relative;
		display: flex;
		flex-direction: column;
		height: calc(100vh);

		&__top {
			padding: 0 40rpx;

			// background-color: #fff;
			&__left {
				font-family: PingFang SC;
				font-weight: 500;
				font-size: 25rpx;
				color: #868A8B;
				line-height: 25rpx;
			}

			&__right {
				font-family: PingFang SC;
				font-weight: 500;
				font-size: 24rpx;
				color: #45C47B;
				line-height: 24rpx;
			}

			&__unit {
				font-family: PingFang SC;
				font-weight: bold;
				font-size: 55rpx;
				color: #000000;
				line-height: 55rpx;
				// padding-bottom: 10rpx;
			}
		}

		&__way {
			padding: 24rpx 30rpx 40rpx;
			background-color: #fff;

			&__title {
				font-family: PingFang SC;
				font-weight: 500;
				font-size: 32rpx;
				color: #000000;
				line-height: 32rpx;
				margin-bottom: 38rpx;
			}

			&__icon {
				width: 36rpx;
				height: 36rpx;
				margin-right: 20rpx;
			}

			&__name {
				font-family: PingFang SC;
				font-weight: 500;
				font-size: 30rpx;
				color: #000000;
				line-height: 30rpx;
			}

			&__tip {
				padding: 22rpx;
				background: #F3F5F7;
				border-radius: 20rpx;
				font-family: PingFang SC;
				font-weight: 500;
				font-size: 24rpx;
				color: #86888A;
				line-height: 38rpx;
				margin-top: 34rpx;
			}
		}

		&__mx {
			padding: 0 30rpx 66rpx;
			background: linear-gradient(#fff 0%, #F4F4F4 10%, #F4F4F4 100%);
			margin-top: -20rpx;

			// flex: 1;
			&__top {
				width: 690rpx;
				height: 138rpx;
				position: relative;

				&__text {
					position: relative;
					padding: 43rpx 32rpx;
					font-family: AlimamaShuHeiTi;
					font-weight: bold;
					font-size: 32rpx;
					color: #00001C;
					line-height: 30rpx;
				}
			}

			&__topbg {
				width: 690rpx;
				height: 138rpx;
				position: absolute;
				top: 0;
				left: 0;
			}

			&__box {
				width: 690rpx;
				height: calc(100% - 138rpx);
				background: #FFFFFF;
				border-radius: 0rpx 0rpx 30rpx 30rpx;

			}

			&__list {
				padding-left: 35rpx;

				&__item {
					padding: 16rpx 36rpx 16rpx 0;
					display: flex;
					align-items: flex-start;
					justify-content: space-between;
					border-bottom: 1rpx solid #F4F4F4;

					&__icon {
						width: 97rpx;
						height: 97rpx;
						margin-left: -16rpx;
						margin-right: 20rpx;
					}

					&__center {
						display: flex;
						flex-direction: column;
						justify-content: center;

					}

					&__text {
						font-weight: 800;
						font-size: 27rpx;
						color: #181818;
						line-height: 27rpx;
						margin-bottom: 19rpx;
					}

					&__time {
						font-family: PingFang SC;
						font-weight: bold;
						font-size: 24rpx;
						color: #616161;
						line-height: 24rpx;
						opacity: 0.8;
					}

					&__price {
						font-family: DINNextLTPro-Bold;
						font-weight: bold;
						font-size: 34rpx;
						color: #4DC680;
						line-height: 24rpx;
						margin-top: 22rpx;
					}
				}
			}
		}
	}

	.line {
		width: 750rpx;
		height: 20rpx;
		background: #F4F4F4;
	}

	.checkbox {
		width: 28rpx;
		height: 28rpx;
		display: flex;
		align-items: center;
		justify-content: center;
		margin-right: 9rpx;

		&__icon {
			width: 28rpx;
			height: 28rpx;
		}
	}
</style>